Skip to content

chore: implements error handling tests for fastapi - #206

Open
dom96 wants to merge 1 commit into
mainfrom
dominik/fastapi-error-handling-tests
Open

chore: implements error handling tests for fastapi#206
dom96 wants to merge 1 commit into
mainfrom
dominik/fastapi-error-handling-tests

Conversation

@dom96

@dom96 dom96 commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

simple routes which perform validation using pydantic and which return exceptions/other common error status codes

@dom96
dom96 requested review from hoodmane and ryanking13 August 14, 2026 14:24
@ask-bonk

ask-bonk Bot commented Aug 14, 2026

Copy link
Copy Markdown

I've reviewed the full diff, the existing test patterns, and the shared client helpers. The PR adds error-handling test routes to the FastAPI worker and a corresponding test file. The code is clean, follows existing conventions in the test suite, and the tests cover meaningful scenarios (HTTPException variants, Pydantic validation for body/query/path, custom exception handlers, and unhandled exceptions).

One minor issue: the error_validate_body route returns only name and price but omits quantity, even though quantity is part of the ItemModel. The test test_valid_body_passes only checks name and price so it passes, but the route silently drops a field from the model. This isn't a bug per se (the test does pass), but it's inconsistent — a test validating the happy path should ideally verify all accepted fields round-trip correctly. However, this is a test file, and the route is purpose-built for testing validation, so this is borderline nitpick territory.

I see no logic bugs, security issues, or other actionable problems. The tests are well-structured, use the established _client helpers, follow the pytest.mark.asyncio + fastapi_app fixture pattern from the other test files, and cover the cases described in the module docstring.

LGTM

github run

@dom96
dom96 force-pushed the dominik/fastapi-error-handling-tests branch from 80b293c to a87126f Compare August 14, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant